//
//  StellNameTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/11/17.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "StellNameTableViewCell.h"

@interface StellNameTableViewCell ()
{
    GLGWLabel * haveSynchronousLabel;
    //
    GLGWLabel * stellNamelabel;
    GLGWLabel * specificationsLabel;
    GLGWLabel * piceLabel;
}
@end

@implementation StellNameTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        stellNamelabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(15), kHeightProportion_In_iPhoneTriploid(17), KScreenWidth - kWidthProportion_In_iPhoneTriploid(30), kHeightProportion_In_iPhoneTriploid(25)) theFont:BOLDSYSTEMFONT(18) theColor:kColor_Rule_Black inSuperView:self];
//        stellNamelabel.backgroundColor = kRandomColor;
        
        //
        haveSynchronousLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:kColor_Rule_Yellow inSuperView:self];
        haveSynchronousLabel.textAlignment = NSTextAlignmentCenter;
        haveSynchronousLabel.text = @"已同步";
        haveSynchronousLabel.layer.borderColor = kColor_Rule_Yellow.CGColor;
        haveSynchronousLabel.layer.borderWidth = 1.0;
        haveSynchronousLabel.layer.masksToBounds = YES;
        [haveSynchronousLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.mas_top).offset(kHeightProportion_In_iPhoneTriploid(17));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(55)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        //
        specificationsLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(stellNamelabel.x, kY_With_View(stellNamelabel, 10), stellNamelabel.width, kHeightProportion_In_iPhoneTriploid(20)) theFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:self];
        specificationsLabel.text = @"φ6*12   北京京南国储库   剩余35件";
        //
        piceLabel = [[GLGWLabel alloc] initWithFrame:CGRectMake(specificationsLabel.x, kY_With_View(specificationsLabel, 10), KScreenWidth - kWidthProportion_In_iPhoneTriploid(130), kHeightProportion_In_iPhoneTriploid(22)) theFont:BOLDSYSTEMFONT(16) theColor:[UIColor colorWithHexString:@"#EC5353"] inSuperView:self];
        piceLabel.attributedText = [GLGWLabel bllChangeStr:@"￥3845/吨" changewithStr:@"/吨" changeColoer:[UIColor colorWithHexString:@"#999999"] withFont:SYSTEMFONT(12)];
        //
        GLGWButton * calculatorBut = [[GLGWButton alloc] initWithTitle:@"计算器" titleLableFont:SYSTEMFONT(16) titleLableColor:kColor_Rule_Yellow inSuperView:self];
        calculatorBut.image_Name =@"icon_jisuanqi";
        [calculatorBut setImagePositionWithType:SSImagePositionTypeLeft spacing:kWidthProportion_In_iPhoneTriploid(10)];
        calculatorBut.backgroundColor = [UIColor colorWithHexString:@"#A89A60" alpha:0.2];
        [calculatorBut mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_right).offset(0);
            make.bottom.equalTo(self.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(15));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(100)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(30)));
        }];
        [calculatorBut addTarget:self action:@selector(calculatorAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}

-(void)setDataModel:(GoodsInformationModel_Data *)dataModel{
    _dataModel = dataModel;
    stellNamelabel.text = @"三级螺纹钢 HRB400E 河钢";
//    stellNamelabel.text = [NSString stringWithFormat:@"%@ %@ %@",koString(_dataModel.productName),koString(_dataModel.productMaterial),koString(_dataModel.)]
}

-(void)calculatorAction{
    if (self.Block_CalatorAction) {
        self.Block_CalatorAction();
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
